package chapter06.Example14;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class Example14 {
    public static void main(String[] args) {
        HashMap map = new HashMap();
        map.put("逆天","逆大天");
        map.put("1","张三");
        map.put("2","李四");
        map.put("3","王五");
        System.out.println(map);
        //使用迭代器 取出所有数据
        Set keyset = map.keySet();
        Iterator it = keyset.iterator();
        while (it.hasNext()){
            Object key = it.next();
            System.out.println(key + ":" + map.get(key));
        }

    }
}
